package org.jks.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.google.gson.annotations.Expose;

@Entity
@Table(name = "privilege")
public class Privilege {
	@Expose
	@Id
	@GeneratedValue(generator = "increment")
	@GenericGenerator(name = "increment", strategy = "increment")
	@Column(name = "id")
	private long id;
	@Expose
	@Column(name = "name", length = 64, nullable = false)
	private String name;
	@Expose
	@Column(name = "value")
	private long value;
	@Expose
	@Column(name = "desp", length = 512, nullable = false)
	private String desp;
	@Expose
	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "privilege")
	private Set<Model> model = new HashSet<Model>();

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public long getValue() {
		return value;
	}

	public void setValue(long value) {
		this.value = value;
	}

	public String getDesp() {
		return desp;
	}

	public void setDesp(String desp) {
		this.desp = desp;
	}

	public Set<Model> getModel() {
		return model;
	}

	public void setModel(Set<Model> model) {
		this.model = model;
	}

}
